package com.ht.impl.demo;

import com.mxgraph.util.mxConstants;
import com.mxgraph.util.mxUtils;
import com.mxgraph.io.mxCodec;
import com.ht.impl.ViewerMenuBar;
import com.ht.impl.CustomGraphViewer;
import com.htgraph.renderer.CellRenderUpdator;
import com.htgraph.renderer.IeeeDataRenderer;


import java.awt.*;
import java.io.IOException;

import org.w3c.dom.Document;

/**
 * Created by IntelliJ IDEA.
 *
 * @author Wang jiaxiang
 *         Date: 2010-7-15
 */
public class GraphIeeeViewerDemo {

    public static void main(String[] args) throws IOException {
        mxConstants.SHADOW_COLOR = Color.LIGHT_GRAY;
        CustomGraphViewer editor = new CustomGraphViewer();
        editor.createFrame(new ViewerMenuBar(editor)).setVisible(true);

        CellRenderUpdator updator = new IeeeDataRenderer(editor.getGraphComponent().getGraph().getModel());

        Document document = mxUtils.parseXml(mxUtils
                        .readFile(CustomGraphViewer.class.getResource("/mxefile/case14.mxe").getPath()));
                mxCodec codec = new mxCodec(document);
                codec.decode(document.getDocumentElement(),
                        editor.getGraphComponent().getGraph().getModel());
    }

}
